﻿/***************************************************************************
 * 文件名：ConstDataStorage
 * 功能：实体定义
 * 说明：
 * -------------------------------------------------------------------------
 * 创建时间：2024/6/26 16:07:19
 * 创建人：金文旭
 * 邮箱： mohayashi@163.com
 * =========================================================================
 *
 * 修改人：   
 * 修改时间：   
 * 修改说明：   
 ***************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectDataChangeSync
{
    internal abstract class ContextData_Base
    {
        static internal TransformLaw[] TransformLaws { get; set; }
    }
    /// <summary>
    /// 
    /// </summary>
    internal class ProjectContextData : ContextData_Base
    {
        internal string BudProjCode { get; set; }
        internal string ProjCode { get; set; }
        internal string ProjName { get; set; }
        internal string DeptCode { get; set; }
        internal string LPersonId { get; set; }
        internal string ProjTypeCode { get; set; }
        new internal TransformLaw[] TransformLaws { get; set; } = new TransformLaw[]
        {
            new TransformLaw()
            {
                sourceType=typeof(string),
                targetType=typeof(string),
                SourceField="xmbh",
                TargetField="BudProjCode",
                DoTrans = delegate (object source)
                {
                    //这里写处理规则
                    return (string)source;
                }
            },
            new TransformLaw()
            {
                sourceType=typeof(string),
                targetType=typeof(string),
                SourceField="xmmc",
                TargetField="ProjCode",
                DoTrans = delegate (object source)
                {
                    //这里写处理规则
                    return (string)source;
                }
            },
            new TransformLaw()
            {
                sourceType=typeof(string),
                targetType=typeof(string),
                SourceField="fzbh",
                TargetField="LPersonId",
                DoTrans = delegate (object source)
                {
                    //这里写处理规则
                    return (string)source;
                }
            },
            new TransformLaw()
            {
                sourceType=typeof(string),
                targetType=typeof(string),
                SourceField="kyxmbh",
                TargetField="ProjCode",
                DoTrans = delegate (object source)
                {
                    //这里写处理规则
                    return (string)source;
                }
            },
            new TransformLaw()
            {
                sourceType=typeof(string),
                targetType=typeof(string),
                SourceField="xmfl",
                TargetField="ProjTypeCode",
                DoTrans = delegate (object source)
                {
                    //这里写处理规则
                    return (string)source;
                }
            },
            new TransformLaw()
            {
                sourceType=typeof(string),
                targetType=typeof(string),
                SourceField="bmbh",
                TargetField="DeptCode",
                DoTrans = delegate (object source)
                {
                    //这里写处理规则
                    return (string)source;
                }
            },
        };
        internal const string SourceDbNameConst = "KYXM_HD";
        internal const string TargetDbNameConst = "Dev";
        internal const string SourceTableNameConst = "KY_LXBG_TRANS";
        internal const string TargetTableNameConst = "PM_Project";
    }

    internal class TransformLaw
    {
        internal Type sourceType;
        internal Type targetType;
        internal string SourceField { get; set; }
        internal string TargetField { get; set; }
        internal delegate object DoTransForm(object source);
        internal DoTransForm DoTrans;
    }
}
